<template>
  <div id="manage">
    <!-- <div class="summary" >
      <div class="summaryItem">
        <i class="iconfont iconyanjiedianjia"></i>
        <span class="itemText">污水池总数(个)</span>
        <span class="itemNum">{{summaryData.unitCount}}</span>
      </div>
      <el-divider direction="vertical"></el-divider>
      <div class="summaryItem">
        <i class="iconfont iconthemoon"></i>
        <span class="itemText">收运总量(个)</span>
        <span class="itemNum">{{summaryData.monthCount}}</span>
      </div>
      <el-divider direction="vertical"></el-divider>
    
      <div class="summaryItem">
        <i class="iconfont iconavg"></i>
        <span class="itemText">月均收运量(t)</span>
        <span class="itemNum">{{summaryData.volumeMonth}}</span>
      </div>
            <el-divider direction="vertical"></el-divider>

        <div class="summaryItem">
        <i class="iconfont iconlajitong1"></i>
        <span class="itemText">日均收运量(t)</span>
        <span class="itemNum">{{summaryData.volumeTotal}}</span>
      </div>
    </div> -->
    <div class="tableDiv">
      <div class="condition">
        <div class="firstInput">
          <p>开始时间</p>
          <el-date-picker
            size="small"
            placement="bottom-start"
            v-model="searchParam.startTime"
            type="month"
            value-format="yyyy-MM"
            placeholder="选择开始时间"
            style="width:158px"
          ></el-date-picker>
        </div>
        <div class="secondInput">
          <p>结束时间</p>
          <el-date-picker
            size="small"
            placement="bottom-start"
            v-model="searchParam.endTime"
            value-format="yyyy-MM"
            type="month"
            placeholder="选择结束时间"
            style="width:158px"
          ></el-date-picker>
        </div>
        <div class="searchBtn">
          <el-button
            size="small"
            type="primary"
            @click="dataRender()"
          >查询</el-button>
          <el-button
            size="small"
            type="primary"
            @click="dataExport()"
          >导出数据</el-button>
        </div>
      </div>
      <div class="z-pagecontent">
      <el-table :data="tableData" border stripe v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;" :height="maxHeight">
        <el-table-column type="selection" header-align="center" align="center" width="50">
        </el-table-column>
        <el-table-column type="index" header-align="center" label="序号" align="center" width="50">
        </el-table-column>
        <el-table-column prop="numberPlate" header-align="center" align="center" label="统计时间" min-width="130" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="status" header-align="center" align="center" label="收运总量" min-width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ statusMap[scope.row.status] }}
          </template>
        </el-table-column>
      
      </el-table>
      <el-pagination
        @size-change="sizeChangeHandle"
        @current-change="currentChangeHandle"
        :current-page="pageIndex"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        :total="totalPage"
        layout="total, sizes, prev, pager, next, jumper">
      </el-pagination>
    </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "collReport",
  data() {
    return {
      clientHeight: document.body.clientHeight, //窗口可视区域高度
      // 上面的汇总数据
      summaryData: "",
      //搜索条件
      searchParam: {
        startTime: "",
        endTime: ""
      },
      tableData: [],
      carList: [], //车辆list
      personList: [], //人员list
      tableMaxHeight: 0, //表格的最大高度
      curPage: 1,
      pageSize: 10,
      totalPage: 0,
      pageIndex:1,
      dataList: [],
      dataListLoading: false,
      maxHeight: document.documentElement.clientHeight - 260,
    
    };
  },
  mounted() {
    this.initCondition();
    this.getList();
    // this.getSummary();
  },
  
  methods: {

    selectionChangeHandle() {
      
    },
    //初始化查询条件
    initCondition() {
      let date = new Date();
      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      month = month < 10 ? "0" + month : month;
      let day = year.toString() + "-" + month.toString()+"-"+date.toDateString();
      this.searchParam.startTime = day;
      this.searchParam.endTime = day;
    },

    // getSummary() {


    //    this.$http({
    //     url: this.$http.adornUrl('/sign/report/getSummaryReport'),
    //     method: 'post',
    //     data:{},
    //   }).then(({ data }) => {
    //     if (data && data.code === 0) {
          
    //     } else {

    //     }
    //   })
    // },
    //数据渲染
    getList() {

      let param = {
        param: JSON.stringify(this.searchParam)
      };

       this.$http({
        url: this.$http.adornUrl('/sign/report/getDailyTotalReport'),
        method: 'post',
        param,
      }).then(({ data }) => {
        if (data && data.code === 0) {
          
        } else {
          this.tableData = []
        }
      })
    },

    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    },
    // 多选
    selectionChangeHandle(val) {
      this.dataListSelections = val
    },
    //导出数据
    dataExport() {
      
  
      window.location.href =
        api.url_report_ctStatistics_export + "?param=" + encodeURI(param);
    }
  }
};
</script>

<style scoped lang='scss'>
@mixin inputLocation($width: 220px, $inputWidth: 180px) {
    width: $width;
    display: flex;
    align-items: center;
    justify-content: center;

    & > p {
        font-size: 13px;
        line-height: $conditionHeight;
        margin-right: 10px;
    }
    .input {
        width: $inputWidth;
    }
}
$themeColor: #00284d;
$themeLight: #2bffff;
$fontColor: #fff;

$font32: 32px;
$black: #000000;

$containerTop: 80px;
$topHeight: 60px;
$conditionHeight: 32px; //表格上方条件的高度

#manage {
    font-family: PingFang SC;
    position: relative;
    height: 100%;
    .condition{
      display: flex;
      width: 100%;
      align-items: center;
    }
}
.firstInput {
  @include inputLocation(260px);
}
.secondInput {
  @include inputLocation(260px);
}
.searchBtn {
  width: 20%;
  float: left;
}
</style>
<style lang='scss'>
.summary {
  width: 100%;
  height: 15%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 1);
  margin: 0 auto;
  .el-divider--vertical {
    margin: 0 2px !important;
  }
}
.tableDiv {
  width: 100%;
  margin-top: 1%;
  background: rgba(255, 255, 255, 1);
  .condition {
    width: 100%;
    height: 10.5%;
    padding-left: 3%;
    padding-top: 1%;
  }
  .table {
    width: 100%;
    height: auto;
  }
}
.summaryItem {
  width: 23%;
  height: 100px;
  line-height: 100px;
  display: flex;
  // align-items: center;
  .itemText {
    font-size: 15px;
    margin-left: 12px;
    font-family: PingFangSC;
    font-weight: 400;
    color: rgba(68, 68, 68, 1);
    width: 118px;
    height: 16px;
  }
  .itemNum {
    width: 34px;
    height: 18px;
    font-size: 23px;
    font-family: DINPro;
    font-weight: 500;
    color: rgba(37, 43, 58, 1);
    margin-left: 10px;
  }
}
.iconfont {
  width: 30px;
  height: 30px;
  color: #167fff;
}
</style>
